﻿using H.Eyes;
using H.Types;

namespace H.DML.See
{
    public class DMImgSeeB : DMImgSee
    {
        public DMImgSeeB(DMEye dml, IImgEntity[] imgs, DMOption option) : base(dml, imgs, option)
        {
        }


        ///<inheritdoc/>
        public override int See(Rect matchRect, out Pos matchPoint)
        {
            int result = base.See(matchRect, out matchPoint);
            if (result != -1)
            {
                matchPoint.Offset(_BaseOffsets[result]);
            }
            return result;
        }

        ///<inheritdoc/>
        public override int[] See(Rect matchRect, out Pos[] matchPoints)
        {
            int[] result = base.See(matchRect, out matchPoints);
            if (result != null)
            {
                for (int i = 0; i < matchPoints.Length; i++)
                {
                    matchPoints[i].Offset(_BaseOffsets[result[i]]);
                }
            }
            return result;
        }
    }
}
